import { http } from "@/utils/http";

export type commonResult<T> = {
  code: number;
  msg: string;
  result: T;
};

export type infoType = {
    dutyName: any;
    drawingName: any;
    buildingName: any;
    groupName: any;
	FacilitIcon?:any,
	FacilitType?:any,
	id?: number,
	prodcutId:any,
	productId: any,
	projectId?: number,
	projectName?:string,
	facilitName?: string,
	insidePosition?:string,
	outsidePostion?:string,
	groupId?: number,
	position?: number,
	buildingId?: any,
	drawingId?: any,
	drawingPoint?: any,
	markPoint?:any,
	childrenbuilding?:any,
	// lat?:any,
	// lng?:any,
	area?:any,
	facilitSN?: string,
	faciltType?: string,
	dutyUid?: number,
	outDate?: string,
	expireDate?: string,
	fixDate?: string,
	scrapDate?: string,
	mainteDate?: string,
	mainteCycle?: number,
	cycleValue?: number,
	inspectionMode?: number,
	NFC?: string,
	QR?: string,
	inspect?: any,
	inspectContent?: string,
	facilitImg?: string[],
	place?: string,
}
export type infoTypeList = {
  data: infoType[];
  total: number;
};

const List = '/business/project/facilit/v2/facilits';
const Url = '/business/project/facilit/v2/facilit';
export const getList = (params?: object) => {
  return http.request<commonResult<infoTypeList>>("get", List, {
    params
  });
};
export const getInfo = (params?: object) => {
  return http.request<commonResult<infoType>>("get", Url, {
    params
  });
};
export const addInfo = (data?: object) => {
  return http.request<commonResult<any>>("post", Url, {
    data
  });
};
export const editInfo = (data?: object) => {
  return http.request<commonResult<any>>("put", Url, {
    data
  });
};
export const deleteInfo = (data?: object) => {
  return http.request<commonResult<any>>("delete", Url, {
    data
  });
};
/** 分组下拉框 */
export const groupSelectList = (params?: object) => {
	return http.request<commonResult<Array<any>>>("get", '/business/project/group/v2/groups-op', {
	  params
	});
  }
/** 2.5.6.1设施左侧列表选项*/
  export const facilityTreeList = (params?: object) => {
	return http.request<commonResult<Array<any>>>("get", '/business/project/facilit/v2/buildings', {
	  params
	});
  }

  
  /** 2.5.6.7 获取设施类型*/
  export const getProductNoIDTypeSelectList = (params?: object) => {
	return http.request<commonResult<Array<any>>>("get", '/business/project/facilit/v2/facilit-type', {
	  params
	});
  }